import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
    {
        path: '/',
        name: 'Home',
        component: () => import('@home/Index.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('@login/Index.vue')
    },
    {
        path: '/publish',
        name: 'Publish',
        component: () => import('@publish/Index.vue')
    },
    {
        path: '/profile',
        name: 'Profile',
        component: () => import('@profile/Index.vue'),
        children: [
            {
                path: 'base/:id?',
                name: 'Info',
                component: () => import('@/views/profile/info/Index.vue')
            },
            {
                path: 'account',
                name: 'Account',
                component: () => import('@/views/profile/acount/Index.vue')
            },
            {
                path: 'addme',
                name: 'AddMe',
                component: () => import('@/views/profile/addme/Index.vue')
            },
            {
                path: 'custom',
                name: 'custom',
                component: () => import('@/views/profile/custom/Index.vue')
            },
            {
                path: 'student',
                name: 'Student',
                component: () => import('@/views/profile/student/Index.vue')
            }
        ]
    },
    {
        path: '/project',
        name: 'Project',
        component: () => import('@project/Index.vue'),
        children: [
            {
                path: 'info/:id',
                name: 'ProjectInfo',
                component: () => import('@project/info/Index.vue'),
            },
            {
                path: 'join',
                name: 'ProjectJoin',
                component: () => import('@project/join/Index.vue'),
            },
            {
                path: 'find',
                name: 'FindMember',
                component: () => import('@project/find/Index.vue'),
            }
        ]
    },
    {
        path: '/message',
        name: 'Message',
        component: () => import('@message/Index.vue'),
        children: [
            {
                path: '',
                name: 'SystemMsg',
                component: () => import('@message/system/Index.vue'),
            },
            {
                path: 'private',
                name: 'PrivateMsg',
                component: () => import('@message/private/Index.vue'),
            },
            {
                path: 'group',
                name: 'GroupMsg',
                component: () => import('@message/group/Index.vue'),
            }
        ]
    }
]

export default new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})